package com.punai.standard.controller;

import com.punai.common.annotation.Log;
import com.punai.common.core.controller.BaseController;
import com.punai.common.core.domain.AjaxResult;
import com.punai.common.core.page.TableDataInfo;
import com.punai.common.enums.BusinessType;
import com.punai.standard.domain.StaLinkFbGx;
import com.punai.standard.service.IStaLinkFbGxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 工序分包费用项 关联工序Controller
 * 
 * @author zxw
 * @date 2022-12-13
 */
@RestController
@RequestMapping("/sta/linkFbGx")
public class StaLinkFbGxController extends BaseController
{
    @Autowired
    private IStaLinkFbGxService staLinkFbGxService;

    /**
     * 查询工序分包费用项 关联工序列表
     */
    @PreAuthorize("@ss.hasPermi('sta:linkFbGx:list')")
    @GetMapping("/list")
    public TableDataInfo list(StaLinkFbGx staLinkFbGx)
    {
        startPage();
        List<StaLinkFbGx> list = staLinkFbGxService.selectStaLinkFbGxList(staLinkFbGx);
        return getDataTable(list);
    }

    /**
     * 获取工序分包费用项 关联工序详细信息
     */
    @PreAuthorize("@ss.hasPermi('sta:linkFbGx:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(staLinkFbGxService.selectStaLinkFbGxById(id));
    }

    /**
     * 新增工序分包费用项 关联工序
     */
    @PreAuthorize("@ss.hasPermi('sta:linkFbGx:add')")
    @Log(title = "工序分包费用项 关联工序", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody StaLinkFbGx staLinkFbGx)
    {
        return toAjax(staLinkFbGxService.insertStaLinkFbGx(staLinkFbGx));
    }

    /**
     * 修改工序分包费用项 关联工序
     */
    @PreAuthorize("@ss.hasPermi('sta:linkFbGx:edit')")
    @Log(title = "工序分包费用项 关联工序", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody StaLinkFbGx staLinkFbGx)
    {
        return toAjax(staLinkFbGxService.updateStaLinkFbGx(staLinkFbGx));
    }

    /**
     * 删除工序分包费用项 关联工序
     */
    @PreAuthorize("@ss.hasPermi('sta:linkFbGx:remove')")
    @Log(title = "工序分包费用项 关联工序", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(staLinkFbGxService.deleteStaLinkFbGxByIds(ids));
    }
}
